<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:composition template="index.xhtml">
		<h:form>
		<h:dataTable value="#{estoqueMB.estoqueCompleto}" var="estoque" styleClass="table" headerClass="tableColumnsHeader" rowClasses="tableFirstLine,tableNextLine" >
            <h:column>
                <f:facet name="header">Nome</f:facet>
                #{estoque.material.descricao}
                #{estoque.medicamento.nome}
             	               	 
            </h:column>
            <h:column>
                <f:facet name="header">Validade</f:facet>
                <h:outputText value="#{estoque.data_vencimento.time}" >
                	<f:convertDateTime pattern="dd.MM.yyyy" />
                </h:outputText>		 
            </h:column>
            <h:column>
                <f:facet name="header"></f:facet>
                <h:inputHidden value="#{estoque.id}" />
				<h:commandButton image="/Template/img/car.png" action="#{estoqueMB.irNoItemEstoque()}" title="Retirar do estoque" > 
					<f:setPropertyActionListener target="#{estoqueMB.estoque}" value="#{estoque}"/>
				</h:commandButton> 
				
				<h:commandButton image="/Template/img/mesa.png" action="#{estoqueMB.irNaMesa()}" title="Inserir na mesa" > 
					<f:setPropertyActionListener target="#{estoqueMB.estoque}" value="#{estoque}"/>
				</h:commandButton>
            </h:column>
		</h:dataTable>
		</h:form>
	</ui:composition>
</html>